var motdpe_url = 'https://motdpe.blackbe.xyz/api.php?'
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

LB.EXTENSION.motdpe = (mcaddr)=>{
    let rgx = RegExp(/(.*)(:)(.*|)/,'g')
    if(mcaddr == mcaddr.match(rgx)){
        var mc_url = mcaddr.replace(rgx,'$1')
        var mc_port = mcaddr.replace(rgx,'$3')
        var url = motdpe_url+'ip='+mc_url+'&port='+mc_port
    }
    LB.HELPER.HTTPGET(url,(res)=>{
        switch(res.status){
            case 'offline':
                LB.bot.toMgmtGroup(LB.HELPER.MSG.getMOTDPEevent('server_offline',mcaddr))
            break;

            case 'online':
                LB.bot.toMgmtGroup(LB.HELPER.MSG.getMOTDPEevent('server_online', res.status, res.ip, res.port, res.motd, res.agreement, res.version, res.online, res.max, res.gamemode, res.delay))
        }
    })
}